function onMessageHandler(response) {
    console.log(response);
    document.querySelector('strong').innerText = response.status ? '开' : '关';
}

function onReady() {
    browser.runtime.sendMessage({ checkStatus: true }).then(onMessageHandler);
}

function switchStatus() {
    browser.runtime.sendMessage({ switchStatus: true }).then(onMessageHandler);
}

document.querySelector('button').addEventListener('click', switchStatus, false);
window.addEventListener('load', onReady, false);
